home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / PolyEd / Macros / Tutorial / getattr.ped < prev    next >
Text File  |  1996-09-26  |  4KB  |  160 lines

  1. /*
  2. ** $VER: getattr.ped 2.0 (23.2.95) written by Robert Brandner
  3. **
  4. ** Demo of the the GETATTR command.
  5. ** This demo is well documentated, and should help you to use this
  6. ** mighty command.
  7. */
  8.  
  9. OPTIONS RESULTS
  10.  
  11. OPTIONS FAILAT 11                           /* ignore warnings          */
  12. SIGNAL ON SYNTAX                            /* ensure clean exit        */
  13. SIGNAL ON FAILURE
  14.  
  15. if (LEFT(ADDRESS(), 6) ~= "POLYED") then do
  16.     if SHOW("Ports", "POLYED.1") then
  17.         address 'POLYED.1'
  18.     else do
  19.         say "PolyEd is not running!"
  20.         exit
  21.     end
  22. end
  23.  
  24. 'LOCKGUI'
  25.  
  26. /*----- insert your code here ------------------------------------------*/
  27.  
  28. /* First, how to get all informations on the application:
  29. ** The informations are placed in nodes of the stem variable APP.
  30. ** If we wouldn't use a stem variable all informations would be placed
  31. ** into the variable RESULT, seperated by spaces.
  32. */
  33.  
  34. 'GETATTR APPLICATION STEM APP.'
  35.  
  36. say "Informations about PolyEd"
  37. say "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯"
  38. say "Version        :" APP.VERSION
  39. say "Public Screen  :" APP.SCREEN
  40. say "Current Project:" APP.CURRENTPROJECT
  41. say "Current Window :" APP.CURRENTWINDOW
  42. say
  43. say "Block Startline:" APP.VAR_BLOCKSTARTLINE
  44. say "Block Startcol :" APP.VAR_BLOCKSTARTCOL
  45. say "Block Endline  :" APP.VAR_BLOCKENDLINE
  46. say "Block Endcol   :" APP.VAR_BLOCKENDCOL
  47. say
  48. say "Findstring     :" APP.VAR_FINDSTRING
  49. say "Changestring   :" APP.VAR_CHANGESTRING
  50. say "Ignore case?   :" APP.FLAG_IGNORECASE
  51. say "Whole words?   :" APP.FLAG_WHOLEWORDS
  52. say
  53. say "Overwrite?     :" APP.FLAG_OVERWRITE
  54. say "Autoindent?    :" APP.FLAG_AUTOINDENT
  55. say "TAB as spaces? :" APP.FLAG_TABISSPACES
  56. say "Wordwrap?      :" APP.FLAG_WORDWRAP
  57. say "Create Icons?  :" APP.FLAG_CREATEICONS
  58. say
  59. say "Backups?       :" APP.FLAG_BACKUPS
  60. say "# Backups      :" APP.VAR_BACKUPS
  61. say "Autosave?      :" APP.FLAG_AUTOSAVE
  62. say "#changes       :" APP.VAR_AUTOSAVE /* # of changes before autosave */
  63. say "flash cursor?  :" APP.FLAG_FLASHCURSOR
  64. say
  65. say "and so on..."
  66.  
  67. say "You may now ask for information of specific fields."
  68. say "See documentation for the available fields."
  69. say "To leave the loop, just press <return>"
  70. say ""
  71.  
  72. OPTIONS prompt "application field> "
  73.  
  74. pull field
  75. do while field ~= ""
  76.     'GETATTR APPLICATION FIELD' field
  77.     say field || ":" RESULT
  78.     say ""
  79.     pull field
  80. end
  81.  
  82. /* Now we get a list of all projects */
  83.  
  84. OPTIONS PROMPT
  85.  
  86. say
  87. say "Press <return> for a list of the projects:"
  88. pull
  89. say
  90.  
  91. 'GETATTR PROJECTS STEM P.'
  92. say "Here is a list of the" P.PROJECTS.COUNT "projects of PolyEd:"
  93. say
  94. do i=0 to P.PROJECTS.COUNT-1    /* from 0 to COUNT-1 ! */
  95.     say P.PROJECTS.i
  96.     say substr("", 1, length(P.PROJECTS.i), "¯")    /* :^) */
  97.  
  98.     /* Here we get the informations on one project into the stem variable PR.
  99.     ** Variables must not be quoted, because ARexx does not evaluate them
  100.     ** if they are.
  101.     */
  102.     'GETATTR' PROJECT NAME P.PROJECTS.i STEM PR.
  103.     say 'complete filename :' PR.FILENAME
  104.     say 'file portion      :' PR.FILE
  105.     say 'path portion      :' PR.PATH
  106.     say 'modifications     :' PR.CHANGES
  107.     say 'lines             :' PR.LINES
  108.     say
  109. end i
  110.  
  111. /*
  112. ** Now we fetch a list of all Text-Windows.
  113. */
  114.  
  115. 'GETATTR WINDOWS STEM W.'
  116. say "Here is a list of the" W.WINDOWS.COUNT "windows of PolyEd:"
  117. say
  118. do i=0 to W.WINDOWS.COUNT-1    /* from 0 to COUNT-1 ! */
  119.     say W.WINDOWS.i
  120.  
  121.     /* Here we get the informations on one window into the stem variable W2.
  122.     ** Variables must not be quoted, because ARexx does not evalute them
  123.     ** if they are.
  124.     */
  125.     'GETATTR' WINDOW '"'W.WINDOWS.i'"' STEM W2.
  126.     say 'project :' W2.PROJECT
  127.     say 'width   :' W2.WIDTH
  128.     say 'height  :' W2.HEIGHT
  129. end i
  130.  
  131. /* Now a list of the macros */
  132.  
  133. say
  134. say "Press <return> for a list of the macros:"
  135. pull
  136. say
  137.  
  138. 'GETATTR MACROS STEM M.'
  139.  
  140. say "Here is a list of the" M.MACROS.COUNT "macros of PolyEd:"
  141. say
  142. do i=0 to M.MACROS.COUNT-1
  143.     say M.MACROS.i
  144. end i
  145.  
  146. /*----- end of custom code area ----------------------------------------*/
  147.  
  148. 'UNLOCKGUI'
  149. EXIT
  150.  
  151. SYNTAX:                                     /* ARexx error...           */
  152.  
  153. say "Error line" SIGL ":" ERRORTEXT(RC)     /* report it...             */
  154. 'UNLOCKGUI'                                 /* Unlock GUI!              */
  155. EXIT                                        /* exit                     */
  156.  
  157. FAILURE:
  158. 'UNLOCKGUI'                                 /* Unlock GUI!              */
  159. EXIT                                        /* exit                     */
  160.